
<?php

$date = isset($_GET['date']) ? $_GET['date'] : date('Y-m-d');
//echo $date;
$date_list = explode("-", $date);
echo "year:".$date_list[0]. "<br>";
echo "Mon:". $date_list[1]. "<br>";


$day_list = $_POST['items'];
$str = "";
for ($i = 1; $i < 32; $i ++)
{
	if (in_array($i, $day_list))
		$str = $str."1,";
	else
		$str = $str. "0,";
}
echo "str:". $str. "<br>";

total_number(2, 12, $str);

function total_number($f, $t, $str)
{
	$total = 0;
	$list = explode(",", $str);
	for($i = $f - 1; $i < $t - 1; $i ++)
	{
		if ($list[$i] == 1)
			$total ++;
	}
	return $total;
}

?>

